function passwordReset() {
	$("#tab").hide();
	$("#search").button({
		icons : {
			primary : "ui-icon-search"
		}
	}).click(function() {
		var params = $("input").serialize();
		$.ajax({
			url : "userSearch.action",
			type : "post",
			dataType : "json",
			data : params,
			beforeSend : validate,
			success : showDetail,
			error : dealError
		});
	});

	$("#pwdReset").button({
		icons : {
			primary : "ui-icon-wrench"
		}
	}).click(function(){
		var params = $("input").serialize();
		$.ajax({
			url : "passwordReset.action",
			type : "post",
			dataType : "json",
			data : params,
			beforeSend : validate,
			success : function() {
				messageWithoutBtn('密码重置成功', 'info', 'top');
			},
			error : dealError
		});
	});
}

function showDetail(data, status) {
	$("#userId").text(data.userId);
	$("#userName").text(data.userName);
	if (data.sex == 1) {
		$("#sex").text('男');
	} else {
		$("#sex").text('女');
	}
	$("#departName").text(data.departName);
	$("#birthday").text(data.birthday);
	$("#tab").show(1000);
}

function validate() {
	var userId = $("#id").val();
	if (userId == '') {
		message('请设置搜索条件！', 'alert', 'top');
		return false;
	}
}